const create = document.querySelector('#create')
const ul = document.querySelector('ul')
let i = 0
create.addEventListener('click', function () {
  if (i >= 20) {
    alert('英雄创建完毕，可单击删除英雄！')
    create.innerHTML='删除英雄'
    return
  }
  datas.forEach(function (item, index) {
    const li = document.createElement('li')
    li.innerHTML = `<img src="./uploads/heros/${item.imgSrc}" alt="" data-id='${index}'>`
    ul.appendChild(li)
    i++
  })
})
ul.addEventListener('click', function (e) {
  if (e.target.tagName === 'IMG') {
    ul.children[e.target.dataset.id].style.opacity = '0'
  }
})